import {watch,unref} from 'vue'
import {useTitle as usePageTitle} from '@vueuse/core'
import { useRouter } from 'vue-router'

export function useTitle(){
    const {currentRoute}=useRouter();// 周边生态
    const pageTitle=usePageTitle()
    // pageTitle.value='首页...'
    // useEffect (()=>{},[])
    watch(
        [()=>currentRoute.value.path],
        ()=>{
            const route=unref(currentRoute)
            const tTitle=route?.meta?.title as string;
            pageTitle.value=tTitle
        }
    )
}